/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package digitaldreamers.games.papermonsters.clients.gameclient.network.packets.sending;

import digitaldreamers.games.papermonsters.clients.gameclient.configurations.Configurations;
import digitaldreamers.libraries.games.clients.networkmanagement.packets.sending.AbSendablePacket;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;

/**
 *
 * @author Dao Le
 */
public class SLoginRequest extends AbSendablePacket {
    private String m_strUsername = null;
    private String m_strPassword = null;
    
    public SLoginRequest(String strUsername, String strPassword) {
        m_strUsername = strUsername;
        m_strPassword = strPassword;
        m_iPacketID = Configurations.LOGIN_REQUEST_ID;
    }
    
    @Override
    public byte[] toByteArray() throws IOException {
        ByteArrayOutputStream BAOS = new ByteArrayOutputStream();
        DataOutputStream DOS = new DataOutputStream(BAOS);

        DOS.writeInt(m_iPacketID);
        DOS.writeUTF(m_strUsername);
        DOS.writeUTF(m_strPassword);

        return BAOS.toByteArray();
    }
}
